<?php

require('top.ajax.php');

$db = Database::getInstance();
if($_POST['email'] != '') {
    /* Insertion */
    $sql = "INSERT INTO emails_noel (email) VALUES ('".$_POST['email']."')";
    $db->query($sql);

    /* Mail */
    $mail = new Mail($_POST['email'], "Confirmation de votre inscription au calendrier de l'Avent e-Citizen");
    $mail->setContent("noel-avent");
    $mail->send();
}

?>